package com.it.operator.utils;

import com.it.pojo.Event;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author code1997
 */
public class SourceUtils {

    private SourceUtils() {

    }

    public static SingleOutputStreamOperator<Event> getEventSource(StreamExecutionEnvironment executionEnvironment) {
        executionEnvironment.setParallelism(1);
        return executionEnvironment.fromElements(
                new Event("tom", "./index", 1000L),
                new Event("tom", "./product?id=10", 2000L),
                new Event("lily", "./index", 3000L),
                new Event("tom", "./order?id=10", 40000L),
                new Event("ailis", "./index", 5000L),
                new Event("tom", "./pay?id=10", 16000L),
                new Event("tom", "./pay?id=1000", 20000L));
    }

    public static DataStreamSource<String> getStringSource(StreamExecutionEnvironment executionEnvironment) {
        return executionEnvironment.fromElements("hello world", "hello python", "hello flink");
    }


}
